package cn.com.io.day20151211;

import java.io.IOException;
import java.io.RandomAccessFile;

/**
 * Created by Administrator on 2015/12/11.
 */
public class AppendContent {
    public static void main(String[] args) throws IOException {
        RandomAccessFile raf = null;
        try {
            raf = new RandomAccessFile("AppendContentText.txt","rw");//以读、写方式打开RandomAccessFile对象
            raf.seek(raf.length());//将记录指针移动到文件的最后
            raf.write("追加的内容12abc！\r\n".getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (raf != null){
                raf.close();
            }
        }
    }
}
